"use client"; import { Suspense, useState } from "react"; import { useParams, useRouter } from "next/navigation"; import HighlightCard from "@/components/dashboard/highlights/HighlightCard"; import ReaderSettingsPopover from "@/components/dashboard/preview/ReaderSettingsPopover"; import ReaderView from "@/components/dashboard/preview/ReaderView"; import { Button } from "@/components/ui/button"; import { FullPageSpinner } from "@/components/ui/full-page-spinner"; import { Separator } from "@/components/ui/separator"; import { useSession } from "@/lib/auth/client"; import { useReaderSettings } from "@/lib/readerSettings"; import { useQuery } from "@tanstack/react-query"; import { HighlighterIcon as Highlight, Printer, X } from "lucide-react"; import { useTRPC } from "@karakeep/shared-react/trpc"; import { BookmarkTypes } from "@karakeep/shared/types/bookmarks"; import { READER_FONT_FAMILIES } from "@karakeep/shared/types/readers"; import { getBookmarkTitle } from "@karakeep/shared/utils/bookmarkUtils"; export default function ReaderViewPage() { const api = useTRPC(); const params = useParams<{ bookmarkId: string }>(); const bookmarkId = params.bookmarkId; const { data: highlights } = useQuery( api.highlights.getForBookmark.queryOptions({ bookmarkId, }), ); const { data: bookmark } = useQuery( api.bookmarks.getBookmark.queryOptions({ bookmarkId, }), ); const { data: session } = useSession(); const router = useRouter(); const { settings } = useReaderSettings(); const [showHighlights, setShowHighlights] = useState(false); const isOwner = session?.user?.id === bookmark?.userId; const onClose = () => { if (window.history.length > 1) { router.back(); } else { router.push("/dashboard"); } }; const handlePrint = () => { window.print(); }; return (
{/* Header */}
Reader View
{/* Mobile backdrop */} {showHighlights && (
{highlights.highlights.map((highlight) => ( ))}
)} ); }